package com.fenghongzhang.day006;

import androidx.appcompat.app.AppCompatActivity;
import androidx.viewpager.widget.ViewPager;

import android.os.Bundle;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {
    private ViewPager vp;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        vp = (ViewPager) findViewById(R.id.vp);
        //1,数据源
        List<String> list = new ArrayList<>();

        for (int i = 1; i <= 3; i++) {
            list.add("第"+i+"个");
        }
        MyAdapter myAdapter = new MyAdapter(this, list);
        //2适配器
        vp.setAdapter(myAdapter);

    }
}
